Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Maya look: skip empty file attributes #3274

Merged
merged 3 commits into from
Jun 14, 2022

Conversation

antirotor
Copy link
Member

Fix

This is fixing look collector so it will skip empty filename attributes. Useful mainly on nodes that defines file attribute but can accept also input from other nodes.

Testing

Create look with shader network, connecting PxrTexture to PxrBump for example in renderman (leaving filename attribute in PxrBump empty. Publishing and loading of the look should be successfull

@antirotor antirotor self-assigned this Jun 2, 2022
Comment on lines 604 to 606
if not source:
self.log.info("source is empty, skipping...")
continue
Copy link
Collaborator

@BigRoy BigRoy Jun 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth adding a comment in code to state why we'd sometimes want to skip collecting on a file node - as a reminder for our future selves.

Since technically with this change it also now allows a user to publish a look using a file node that doesn't have a texture set without that being validated against, yes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesnt Arnold throw an error if this happens? If so we should defo validate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seems this is allowed only for Renderman as it seems. I can add logic just for that but I hate to have so much renderer specific codes....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure if it should be our responsibility to check if a file node is empty or not. I would just allow it across the board and leave it to the artist. It's way too wide of a problem to potentially deal with it for all renderers and their usecases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've limited it to renderman nodes, I believe this is the safest and easiest approch to it

@@ -601,6 +601,11 @@ def collect_resources(self, node):
source,
computed_source))

# renderman allows nodes to have filename attribute empty while
# you can have another incoming connection from different node.
if not source and cmds.nodeType(node).lower().startswith("pxr"):
Copy link
Collaborator

@BigRoy BigRoy Jun 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a better way to limit it to renderman nodes.

You could query the node types relevant to the Pixar Renderman plug-in and could check whether it's part of that plug-in?

E.g. here is how to do the same for Redshift node types:

from maya import cmds

redshift_node_types = set(cmds.pluginInfo("redshift4maya", query=True, dependNode=True))

You'd need to first ensure the plug-in is available/loaded however but you can query against that too - but it might be more explicit than the string comparison?

Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

publish is passing through with an empty file path in render man node

@antirotor antirotor merged commit 45d7238 into develop Jun 14, 2022
@antirotor antirotor deleted the bugfix/look-skip-empty-filename-attributes branch June 14, 2022 08:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants